﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using OA.Bll.Project;
using OA.Model;

namespace OA.Web.Handler
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class AjaxTreeHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type = context.Request.QueryString["type"];
            string result;
            ProjectPhasePresenter presenter = new ProjectPhasePresenter();
            string internalType = context.Request.QueryString["InternalType"];
            if (type == "combobox")
            {
                result = presenter.GetComboboxData(internalType);
            }
            else
            {
                JsonReq req = new JsonReq();
                req.Options = new Dictionary<string, string>();
                req.Options.Add("projectProgressId", context.Request.QueryString["projectProgressId"]);
                req.Options.Add("InternalType", internalType);
                result = presenter.GetSearchAll(req);
            }
            context.Response.Write(result);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
